﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using XNALibrary;
using Microsoft.Xna.Framework;
using FarseerGames.FarseerPhysics.Dynamics;
using FarseerGames.FarseerPhysics.Collisions;
using FarseerGames.FarseerPhysics;
using FarseerGames.FarseerPhysics.Factories;
using NetPong.PongClasses3d;

namespace NetPong.PongClassesCore
{
    //this class manages the playing field for the game
    public abstract class Level : IRenderable
    {
        Body physicsBody;
        Geom physicsGeometry;
        
        public Level(PhysicsSimulator ps)
        {
            physicsBody = BodyFactory.Instance.CreateRectangleBody(ps, 240, 240, 1000);
            physicsBody.Position = Vector2.Zero;
            physicsBody.IsStatic = true;

            //physicsGeometry = GeomFactory.Instance.CreateRectangleGeom(ps, physicsBody, 240, 240, Vector2.Zero, 0f);
            
            physicsGeometry = GeomFactory.Instance.CreateRectangleGeom(ps, physicsBody, 240, 5, new Vector2(0,120),0f);
            physicsGeometry = GeomFactory.Instance.CreateRectangleGeom(ps, physicsBody, 240, 5, new Vector2(0, -120), 0f);
            physicsGeometry = GeomFactory.Instance.CreateRectangleGeom(ps, physicsBody, 5, 240, new Vector2(120, 0), 0f);
            physicsGeometry = GeomFactory.Instance.CreateRectangleGeom(ps, physicsBody, 5, 240, new Vector2(-120, 0), 0f);
             
        }

        public void Update(GameTime gt)
        {
        }

        public Body GetBody()
        {
            return physicsBody;
        }

        #region IRenderable Members

        public abstract void Render(RenderControl rc, GameTime gt);

        #endregion
    }
}
